package com.gitee.cirnochat.file.model.vo.resp;

import com.gitee.cirnochat.file.model.entity.EmojiPack;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.time.ZoneOffset;

/**
 * 表情包响应对象
 */
@Schema(name = "EmojiPackResponse", description = "表情包响应对象")
@Data
@NoArgsConstructor
public class EmojiPackResponse implements Serializable {
    /**
     * 主键ID
     */
    @Schema(description = "表情包ID", example = "1")
    private Long id;

    /**
     * 表情包数量
     */
    @Schema(description = "表情包项数量", example = "10")
    private Integer emojiCount;
    /**
     * 创建时间
     */
    @Schema(description = "创建时间", example = "117151514000")
    private Long createTime;

    /**
     * 更新时间
     */
    @Schema(description = "更新时间", example = "117151514000")
    private Long updateTime;

    public EmojiPackResponse(EmojiPack emojiPack) {
        BeanUtils.copyProperties(emojiPack, this);
        this.createTime = emojiPack.getCreateTime().toEpochSecond(ZoneOffset.UTC);
        this.updateTime = emojiPack.getUpdateTime().toEpochSecond(ZoneOffset.UTC);
    }
}